import java.io.*;
import java.util.Scanner;

public class Demo13 {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入想复制的路径");
        System.out.print("->");
        Scanner scanner = new Scanner(System.in);
        String rootPath = scanner.next();
        System.out.println("请输入复制后的路径");
        System.out.print("->");
        String scrPath = scanner.next();
        try(InputStream inputStream = new FileInputStream(rootPath);
            OutputStream outputStream = new FileOutputStream(scrPath)){
            byte[] buf = new byte[1024];
            while(true){
                int n = inputStream.read(buf);
                if(n == -1){
                    break;
                }
                outputStream.write(buf);
            }

        }catch (IOException e) {
            e.printStackTrace();
        }

    }
}
